<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>Document</title>
	<style>
		.box {
			width: 200px;
			height: 120px;
			border: 1px solid black;
			margin: 10px;
			float: left;
		}

		.box1 {
			/* 默认情况，从上到下渐变 */
			background-image: linear-gradient(red, yellow, green);
		}

		.box2 {
			/* 关键字指定渐变方向 */
			background-image: linear-gradient(to right bottom, red, yellow, green);
		}

		.box3 {
			/* 角度指定渐变方向 */
			background-image: linear-gradient(30deg, red, yellow, green);
		}

		.box4 {
			/* 设置渐变范围 */
			background-image: linear-gradient(red 30px, yellow 60px, green 100px);
		}

		.box5 {
			/* 综合设置 */
			background-image: linear-gradient(30deg, red 30px, yellow 60px, green 100px);
		}
	</style>
</head>
<body>
	<div class="box box1"></div>
	<div class="box box2"></div>
	<div class="box box3"></div>
	<div class="box box4"></div>
	<div class="box box5"></div>
</body>
</html>